// 方式一
function isPalindrome(x) {
  if (x < 0) {
    return false;
  }
  let y = x;
  let prev = 0;
  let next = 0;
  while (x !== 0) {
    prev = x % 10;
    x = (x - prev) / 10;
    next = next * 10 + prev;
  }
  return next === y;
}

console.log(isPalindrome(10));
